#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


import time
from multiprocessing import Process


def work(name, age, **kwargs):
    for i in range(3):
        print(name)
        print(age)
        print(kwargs)
        time.sleep(1)


if __name__ == '__main__':
    p = Process(target=work, args=('安娜', 18), kwargs={'gender': '女'})
    p.start()
    print('主进程正在运行..')
    # time.sleep(1)
    # p.terminate()  # 当主进程退出无论子进程是否完成任务都一起退出

    # 判断当前子进程是否存活
    print(p.is_alive())
    # 主进程等待子进程任务执行完成后再继续向下执行
    p.join()

    print(p.is_alive())
